package com.gdou.teaching.mapper;

import com.gdou.teaching.dataobject.CourseMaster;
import com.gdou.teaching.dataobject.ExperimentMaster;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author bo
 * @date Created in 14:50 2019/7/29
 * @description
 **/
@Mapper
@Repository
public interface ExperimentMasterMapper {
    /**
     * 添加实验主表记录
     * @param experimentMaster
     * @return int
     */
    int addExperimentMaster(ExperimentMaster experimentMaster);

    /**
     * 根据实验ID删除实验主表记录
     * @param experimentId
     * @return boolean
     */
    boolean deleteExperimentMasterByExperimentId (Integer experimentId);

    /**
     * 更新实验主表记录(不更新实验状态)
     * @param experimentMaster
     * @return
     */
    boolean updateExperimentMaster(ExperimentMaster experimentMaster);

    /**
     * 分页查询所有的实验主表记录(包括已被逻辑删除)
     * @param offset
     * @param limit
     * @return
     */
    List<ExperimentMaster> selectExperimentMasterAllForPage(@Param("offset")Integer offset, @Param("limit")Integer limit);
    /**
     * 根据实验ID查询实验主表记录
     * @param experimentId
     * @return ExperimentMaster
     */
    ExperimentMaster selectExperimentMasterByExperimentId(Integer experimentId);

    /**
     * 根据实验名查询实验主表记录
     * @param experimentName
     * @return  List<ExperimentMaster>
     */
    List<ExperimentMaster> selectExperimentMasterByExperimentName(String  experimentName);

    /**
     * 根据实验名分页查询实验主表记录
     * @param experimentName
     * @param offset
     * @param limit
     * @return List<ExperimentMaster>
     */
    List<ExperimentMaster> selectExperimentMasterByExperimentNameForPage(@Param("experimentName") String experimentName, @Param("offset")Integer offset, @Param("limit")Integer limit);


    /**
     * 根据课程ID查询实验主表记录
     * @param courseId
     * @return  List<ExperimentMaster>
     */
    List<ExperimentMaster> selectExperimentMasterByCourseId(Integer  courseId);

    /**
     * 根据课程ID分页查询实验主表记录
     * @param courseId
     * @param offset
     * @param limit
     * @return List<ExperimentMaster>
     */
    List<ExperimentMaster> selectExperimentMasterByCourseIdForPage(@Param("courseId") Integer courseId, @Param("offset")Integer offset, @Param("limit")Integer limit);


    List<Integer> getExperimentMasterIdList(@Param("status") Integer status);

    ExperimentMaster getNextExperimentMaster(@Param("experimentId")Integer experimentId,@Param("courseId")Integer courseId);
}
